import Vue from 'vue'
import App from './App'
import { Socket } from "./socket27/socket.js";
Vue.prototype.$Socket = new Socket()
let param = {
    a_url: "http://v3-a.xgwl.net.cn",
    h_url: "http://v3-h.xgwl.net.cn",
    e_url: "v3-e.xgwl.net.cn",
    sertype: "0",
    port: 'pc',
    onCloseCallback: () => {
        let isLogin = confirm("你要继续登录吗？")
        if (isLogin == false) {
          sessionStorage.clear()
          localStorage.clear()
          location.reload()
        }
        return isLogin;
    },
    onLoginSuccess: (data) => {
        uni.showToast({
            icon:"none",
            title: '连接成功',
            duration: 2000
        });
      store.commit("setUserData", data.userData);
      let talkData = null
      Vue.prototype.$Socket.action('getTalkList',null,(res)=>{
        talkData = res
        if (talkData && talkData.code == 200) { 
          store.commit("setGetTalkList", talkData.data); 
        }
      },()=>{});
    },
    onConnectClose() {
        uni.showToast({
            icon:"none",
            title: '重新链接',
            duration: 2000
        });
    }
  }
  Vue.prototype.$Socket.action('setConfig', {option: param},()=>{},()=>{})

import store from './store'
Vue.prototype.$store = store

import http from '@/API/http.js'
Vue.prototype.$http = http

import basics from './pages/basics/home.vue'
Vue.component('basics',basics)
 
import components from './pages/component/home.vue'
Vue.component('components',components)

import plugin from './pages/plugin/home.vue'
Vue.component('plugin',plugin)

import cuCustom from './colorui/components/cu-custom.vue'
Vue.component('cu-custom',cuCustom)

Vue.config.productionTip = false

App.mpType = 'app'

const app = new Vue({
	...App
})
app.$mount()
